﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;

namespace ServerCommon.Net
{
    /// <summary>
    /// 客户端网络设置
    /// </summary>
    public class ClientSettings
    {
        /// <summary>
        /// 要connect的远程IP/端口
        /// </summary>
        public IPEndPoint RemoteEndPoint;

        /// <summary>
        /// read/recv 的socketAsyncEventArgs数量
        /// </summary>
        public int IOSaeaNum { get; private set; }

        /// <summary>
        /// socketAsyncEventArgs的Buffer大小
        /// </summary>
        public int BufferSizeForEachBlock { get; private set; }

        /// <summary>
        /// 远程IP/端口的字符串
        /// </summary>
        public string RemoteHost { get { return RemoteEndPoint.ToString(); } }

        /// <summary>
        /// 链接错误输出间隔，秒
        /// </summary>
        public int ConnectErrorLogInterval { get; private set; }

        public ClientSettings(IPEndPoint remoteEndPoint, int IOSAEANum, int bufferSizeForEachBlock)
        {
            RemoteEndPoint = remoteEndPoint;
            IOSaeaNum = IOSAEANum;
            BufferSizeForEachBlock = bufferSizeForEachBlock;
            ConnectErrorLogInterval = 60;
        }
    }
}
